package com.hbnu.entity;

import java.util.ArrayList;
import java.util.List;

public class UserFile {
    private int fid;
    private int pid;
    private String fname;
    private String path;
    private int file_id;
    private boolean is_file;
    private List<Integer> list;

    public UserFile(){};
    public UserFile(int fid){
        this.fid=fid;
    };
    public UserFile(int fid,int pid, String fname, int file_id, boolean is_file) {
        this.fid = fid;
        this.pid = pid;
        this.is_file = is_file;
        this.file_id = file_id;
        this.fname = fname;
    }
    public UserFile(int pid, String fname, int file_id, boolean is_file) {
        this.pid = pid;
        this.is_file = is_file;
        this.file_id = file_id;
        this.fname = fname;
    }
    public UserFile(int fid,int pid, String fname, int file_id, boolean is_file, String path) {
        this.fid = fid;
        this.pid = pid;
        this.is_file = is_file;
        this.file_id = file_id;
        this.path = path;
        this.fname = fname;
    }


    public int getFid() {
        return fid;
    }

    public void setFid(int fid) {
        this.fid = fid;
    }

    public List<Integer> getList() {
        return list;
    }
    public boolean hasChildren() {
        return list != null && !list.isEmpty();
    }

    public void addList(int fid){
        if (list == null) {
            list=new ArrayList<>();
        }
        list.add(fid);
    }

    public void set(int pid,  String fname,int file_id,boolean is_file) {
        //this.fid = fid;创建时就有
        this.pid = pid;
        this.is_file = is_file;
        this.file_id = file_id;
        this.fname = fname;
    }

    public int getPid() {
        return pid;
    }

    public void setPid(int pid) {
        this.pid = pid;
    }

    public String getFname() {
        return fname;
    }

    public void setFname(String fname) {
        this.fname = fname;
    }

    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }

    public int getFile_id() {
        return file_id;
    }

    public void setFile_id(int file_id) {
        this.file_id = file_id;
    }

    public boolean is_file() {
        return is_file;
    }

    public void setIs_file(boolean is_file) {
        this.is_file = is_file;
    }
}
